package com.company.cloud.club.modules;

import com.company.cloud.common.utils.MainUtils;
import com.company.common.auth.filter.WebServletRequestReplacedFilter;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.util.unit.DataSize;

import javax.servlet.Filter;
import javax.servlet.MultipartConfigElement;

@EnableHystrix
@EnableFeignClients(basePackages = {"com.company.cloud"})
@EnableAsync
@EnableCaching
@SpringBootApplication(scanBasePackages = {
        "com.company.cloud.club"
})
@MapperScan(value = "com.company.cloud.club.modules.db.dao")
@ComponentScan(basePackages = {"com.company"})
public class ClubServerApplication {

    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        factory.setMaxRequestSize(DataSize.parse("200MB"));
        factory.setMaxFileSize(DataSize.parse("200MB"));
        return factory.createMultipartConfig();
    }

    public static void main(String[] args) {
        SpringApplication.run(ClubServerApplication.class, MainUtils.args(args));
    }

}
